home *** CD-ROM | disk | FTP | other *** search
/ Aminet 50 / Aminet 50 (2002)(GTI - Schatztruhe)[!][Aug 2002].iso / Aminet / text / edit / tecoc-146.lha / execrt.c < prev    next >
C/C++ Source or Header  |  1991-07-05  |  2KB  |  45 lines

  1. /*****************************************************************************
  2.  
  3.     ExeCrt()
  4.  
  5.     This function "executes" a ^ (caret) command.  Most TECO commands
  6. which are control characters (^A, ^B, etc) can also be entered as a caret
  7. and letter combination.  For example, control-A can also be entered as
  8. caret-A.
  9.  
  10. *****************************************************************************/
  11.  
  12. #include "zport.h"        /* define portability identifiers */
  13. #include "tecoc.h"        /* define general identifiers */
  14. #include "defext.h"        /* define external global variables */
  15. #include "chmacs.h"        /* define character processing macros */
  16. #include "deferr.h"        /* define identifiers for error messages */
  17.  
  18. DEFAULT ExeCrt()        /* execute a ^ (caret) command */
  19. {
  20.     unsigned char TmpChr;
  21.     static DEFAULT (*FCAray[])(VVOID) = {
  22.         /* ^A*/ ExeCtA,   /* ^B*/ ZExCtB,   /* ^C*/ ExeCtC,
  23.         /* ^D*/ ExeCtD,   /* ^E*/ ExeCtE,   /* ^F*/ ExeNYI,
  24.         /* ^G*/ ExeIll,   /* ^H*/ ZExCtH,   /*TAB*/ ExeCtI,
  25.         /* LF*/ ExeNul,   /* VT*/ ExeIll,   /* FF*/ ExeCtL,
  26.         /* CR*/ ExeNul,   /* ^N*/ ExeCtN,   /* ^O*/ ExeCtO,
  27.         /* ^P*/ ExeCtP,   /* ^Q*/ ExeCtQ,   /* ^R*/ ExeCtR,
  28.         /* ^S*/ ExeCtS,   /* ^T*/ ExeCtT,   /* ^U*/ ExeCtU,
  29.         /* ^V*/ ExeCtV,   /* ^W*/ ExeCtW,   /* ^X*/ ExeCtX,
  30.         /* ^Y*/ ExeCtY,   /* ^Z*/ ExeCtZ,   /* ^[*/ ExeEsc,
  31.         /* ^\*/ ExeIll,   /* ^]*/ ExeIll,   /* ^^*/ ExeCCC,
  32.         /* ^_*/ ExeUsc
  33.     };
  34.  
  35.     if (IncCBP() == FAILURE) {
  36.         return FAILURE;
  37.     }
  38.     TmpChr = To_Upper(*CBfPtr);
  39.     if ((TmpChr < 'A') || (TmpChr > '_')) {
  40.         ErrChr(ERR_IUC, *CBfPtr);
  41.         return FAILURE;
  42.     }
  43.     return (*FCAray[TmpChr-'A'])();
  44. }
  45.